<!DOCTYPE html>
<html lang="zh-CN">
  <head>
  <meta charset="UTF-8">
  <meta 
    name="viewport"
    content="width=device-width, initial-scale=1.0, minimum-scale=1.0">
  <meta 
    http-equiv="X-UA-Compatible" 
    content="ie=edge">
  <meta 
    name="theme-color" 
    content="#fff" 
    id="theme-color">
  <meta 
    name="description" 
    content="Hexo">
  <link 
    rel="icon" 
    href="https://demo.theme-kaze.top/img/Kaze.png">
  <title>Mysql Host is blocked because of many connection errors</title>
  
    
      <meta 
        property="og:title" 
        content="Mysql Host is blocked because of many connection errors">
    
    
      <meta 
        property="og:url" 
        content="https://laoma.gitee.io/fungloengblog/2020/08/11/Mysql-Host-is-blocked-because-of-many-connection-errors/index.html">
    
    
      <meta 
        property="og:img" 
        content="https://demo.theme-kaze.top/img/Kaze.png">
    
    
    
      <meta 
        property="og:type" 
        content="article">
      <meta 
        property="og:article:published_time" 
        content="2020-08-11">
      <meta 
        property="og:article:modified_time" 
        content="2021-12-21">
      <meta 
        property="og:article:author" 
        content="IAMFUNGLOENG">
      
        
          <meta 
            property="og:article:tag" 
            content="MySQL">
        
      
    
  
  <script>
    function loadScript(url, cb) {
      var script = document.createElement('script');
      script.src = url;
      if (cb) script.onload = cb;
      script.async = true;
      document.body.appendChild(script);
    }
    function loadCSS(href, data, attr) {
      var sheet = document.createElement('link');
      sheet.ref = 'stylesheet';
      sheet.href = href;
      sheet.dataset[data] = attr;
      document.head.appendChild(sheet);
    }
    function changeCSS(cssFile, data, attr) {
      var oldlink = document.querySelector(data);
      var newlink = document.createElement("link");
      newlink.setAttribute("rel", "stylesheet");
      newlink.setAttribute("href", cssFile);
      newlink.dataset.prism = attr;
      document.head.replaceChild(newlink, oldlink);
    }
  </script>
  
    
  
  <script>
    // control reverse button
    var reverseDarkList = {
      dark: 'light',
      light: 'dark'
    };
    var themeColor = {
      dark: '#1c1c1e',
      light: '#fff'
    }
    // get the data of css prefers-color-scheme
    var getCssMediaQuery = function() {
      return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
    };
    // reverse current darkmode setting function
    var reverseDarkModeSetting = function() {
      var setting = localStorage.getItem('user-color-scheme');
      if(reverseDarkList[setting]) {
        setting = reverseDarkList[setting];
      } else if(setting === null) {
        setting = reverseDarkList[getCssMediaQuery()];
      } else {
        return;
      }
      localStorage.setItem('user-color-scheme', setting);
      return setting;
    };
    // apply current darkmode setting
  </script>
  
    <script>
      var setDarkmode = function(mode) {
      var setting = mode || localStorage.getItem('user-color-scheme');
      if(setting === getCssMediaQuery()) {
        document.documentElement.removeAttribute('data-user-color-scheme');
        localStorage.removeItem('user-color-scheme');
        document.getElementById('theme-color').content = themeColor[setting];
        document.getElementById('theme-color').dataset.mode = setting;
      } else if(reverseDarkList[setting]) {
        document.documentElement.setAttribute('data-user-color-scheme', setting);
        document.getElementById('theme-color').content = themeColor[setting];
        document.getElementById('theme-color').dataset.mode = setting;
      } else {
        document.documentElement.removeAttribute('data-user-color-scheme');
        localStorage.removeItem('user-color-scheme');
        document.getElementById('theme-color').content = themeColor[getCssMediaQuery()];
        document.getElementById('theme-color').dataset.mode = getCssMediaQuery();
      }
    };
    setDarkmode();
    </script>
  
  
  <link rel="preload" href="//at.alicdn.com/t/font_1946621_i1kgafibvw.css" as="style" >
  <link rel="preload" href="//at.alicdn.com/t/font_1952792_89b4ac4k4up.css" as="style" >
  
  
    <link rel="preload" href="/fungloengblog/js/lib/lightbox/baguetteBox.min.js" as="script">
    <link rel="preload" href="/fungloengblog/js/lib/lightbox/baguetteBox.min.css" as="style" >
  
  
    <link rel="preload" href="/fungloengblog/js/lib/lozad.min.js" as="script">
  
  
  
  
  
  
  
  <link rel="stylesheet" href="/fungloengblog/css/main.css">
  
  <link rel="stylesheet" href="//at.alicdn.com/t/font_1946621_i1kgafibvw.css">
  
  <link rel="stylesheet" href="//at.alicdn.com/t/font_1952792_89b4ac4k4up.css">
  
    <link rel="stylesheet" href="/fungloengblog/js/lib/lightbox/baguetteBox.min.css">
  
<meta name="generator" content="Hexo 5.4.0"></head>

  <body>
    <div class="wrapper">
       
      <nav class="navbar">
  <div class="navbar-logo">
    <span class="navbar-logo-main">
      
        <img 
          class="navbar-logo-img"
          width="32"
          height="32"
          src="https://demo.theme-kaze.top/img/Kaze.png" 
          alt="blog logo">
      
      <span class="navbar-logo-dsc">FUNGLOENG</span>
    </span>
  </div>
  <div class="navbar-menu">
    
      <a 
        href="/fungloengblog/" 
        class="navbar-menu-item">
        
          首页
        
      </a>
    
      <a 
        href="/fungloengblog/archives" 
        class="navbar-menu-item">
        
          归档
        
      </a>
    
      <a 
        href="/fungloengblog/tags" 
        class="navbar-menu-item">
        
          标签
        
      </a>
    
      <a 
        href="/fungloengblog/categories" 
        class="navbar-menu-item">
        
          分类
        
      </a>
    
      <a 
        href="/fungloengblog/about" 
        class="navbar-menu-item">
        
          关于
        
      </a>
    
      <a 
        href="/fungloengblog/links" 
        class="navbar-menu-item">
        
          友链
        
      </a>
    
    <a 
      class="navbar-menu-item darknavbar" 
      id="dark">
      <i class="iconfont icon-weather"></i>
    </a>
    <a 
      class="navbar-menu-item searchnavbar" 
      id="search">
      <i 
        class="iconfont icon-search" 
        style="font-size: 1.2rem; font-weight: 400;">
      </i>
    </a>
  </div>
</nav> 
      
      <div 
        id="local-search" 
        style="display: none">
        <input
          class="navbar-menu-item"
          id="search-input"
          placeholder="请输入搜索内容..." />
        <div id="search-content"></div>
      </div>
      
      <div class="section-wrap">
        <div class="container">
          <div class="columns">
            <main class="main-column">
<article class="card card-content">
  <header>
    <h1 class="post-title">
      Mysql Host is blocked because of many connection errors
    </h1>
  </header>
  <div class="post-meta post-show-meta">
    <time datetime="2020-08-11T13:44:49.000Z">
      <i 
        class="iconfont icon-calendar" 
        style="margin-right: 2px;">
      </i>
      <span>2020-08-11</span>
    </time>
    
    
      <span class="dot"></span>
      <span>1.8k 字</span>
    
  </div>
  
    <div 
      class="post-meta post-show-meta" 
      style="margin-top: -10px;">
      <div style="display: flex; align-items: center;">
        <i 
          class="iconfont icon-biaoqian" 
          style="margin-right: 2px; font-size: 1.15rem;">
        </i>
        
          
          <a 
            href="/fungloengblog/tags/MySQL/" 
            class="post-meta-link">
            MySQL
          </a>
        
      </div>
    </div>
  
  </header>
  <div 
    id="section" 
    class="post-content">
    <p>应用环境：mysql8</p>
<p>报错日志：</p>
<pre class="highlight"><span class="line">create connection error, url: jdbc:mysql://localhost:3306/db_wang?useUnicode=true&amp;characterEncoding=UTF-8, errorCode 1129, state HY000java.sql.SQLException: null, message from server: &quot;Host &#x27;127.0.0.1&#x27; is blocked because of many connection errors; unblock with &#x27;mysqladmin flush-hosts&#x27;&quot;</span><br></pre>

<p>原因：</p>
<p>　　同一个ip在短时间内产生太多（超过mysql数据库max_connection_errors的最大值）中断的数据库连接而导致的阻塞；</p>
<p>解决方法：</p>
<p><strong>1、提高允许的max_connect_errors数量（这种方法不彻底，后期还可能导致异常出现）：</strong></p>
<p>　 进入Mysql数据库查看max_connect_errors： </p>
<pre class="highlight"><span class="line">show variables like &#x27;max_connect_errors&#x27;;</span><br></pre>

<p>  修改max_connect_errors的数量为1000：</p>
<pre class="highlight"><span class="line">set global max_connect_errors = 1000;</span><br></pre>

<p>  查看是否修改成功：</p>
<pre class="highlight"><span class="line">show variables like &#x27;max_connect_errors&#x27;;</span><br></pre>

<p>永久解决该问题需要去修改mysql的配置文件，其路径为：</p>
<pre class="highlight"><span class="line">/etc/mysql/my.cnf</span><br></pre>

<p>配置文件中新增以下内容：</p>
<pre class="highlight"><span class="line"><span class="attr">max_connect_errors</span>=<span class="string">1000</span></span><br></pre>



<p><strong>2、使用mysqladmin flush-hosts 命令清理一下hosts文件</strong></p>
<p>在数据库中进行，命令如下：</p>
<pre class="highlight"><span class="line">flush hosts</span><br></pre>



<h3 id="问题"><a href="#问题" class="headerlink" title="问题"></a>问题</h3><p>由于修改mysql配置文件的参数写错了，导致mysql无法启动。通过docker inspect [containerID ]查看信息,找到其中的MergedDir的一长串数字：b57a740dc9670d264c695f4a136b6e46e42240d758939ad65cf173061aa7d4c8</p>
<pre class="highlight"><span class="line">[</span><br><span class="line">    &#123;</span><br><span class="line">        &quot;Id&quot;: &quot;9b8323b8b7763a3d1dfb80aac771434fb26194eca4a1dd5d7cc615d3ef71e39b&quot;,</span><br><span class="line">        &quot;Created&quot;: &quot;2020-07-19T01:36:04.9869417Z&quot;,</span><br><span class="line">        &quot;Path&quot;: &quot;docker-entrypoint.sh&quot;,</span><br><span class="line">        &quot;Args&quot;: [</span><br><span class="line">            &quot;mysqld&quot;</span><br><span class="line">        ],</span><br><span class="line">        &quot;State&quot;: &#123;</span><br><span class="line">            &quot;Status&quot;: &quot;running&quot;,</span><br><span class="line">            &quot;Running&quot;: true,</span><br><span class="line">            &quot;Paused&quot;: false,</span><br><span class="line">            &quot;Restarting&quot;: false,</span><br><span class="line">            &quot;OOMKilled&quot;: false,</span><br><span class="line">            &quot;Dead&quot;: false,</span><br><span class="line">            &quot;Pid&quot;: 9019,</span><br><span class="line">            &quot;ExitCode&quot;: 0,</span><br><span class="line">            &quot;Error&quot;: &quot;&quot;,</span><br><span class="line">            &quot;StartedAt&quot;: &quot;2020-08-13T14:02:18.4352637Z&quot;,</span><br><span class="line">            &quot;FinishedAt&quot;: &quot;2020-08-13T14:01:18.2451932Z&quot;</span><br><span class="line">        &#125;,</span><br><span class="line">        &quot;Image&quot;: &quot;sha256:6e447ce4863d6c90060feaf987711478b4f0bd6e555f6a2a29d43d2163865194&quot;,</span><br><span class="line">        &quot;ResolvConfPath&quot;: &quot;/var/lib/docker/containers/9b8323b8b7763a3d1dfb80aac771434fb26194eca4a1dd5d7cc615d3ef71e39b/resolv.conf&quot;,</span><br><span class="line">        &quot;HostnamePath&quot;: &quot;/var/lib/docker/containers/9b8323b8b7763a3d1dfb80aac771434fb26194eca4a1dd5d7cc615d3ef71e39b/hostname&quot;,</span><br><span class="line">        &quot;HostsPath&quot;: &quot;/var/lib/docker/containers/9b8323b8b7763a3d1dfb80aac771434fb26194eca4a1dd5d7cc615d3ef71e39b/hosts&quot;,</span><br><span class="line">        &quot;LogPath&quot;: &quot;/var/lib/docker/containers/9b8323b8b7763a3d1dfb80aac771434fb26194eca4a1dd5d7cc615d3ef71e39b/9b8323b8b7763a3d1dfb80aac771434fb26194eca4a1dd5d7cc615d3ef71e39b-json.log&quot;,</span><br><span class="line">        &quot;Name&quot;: &quot;/mysql&quot;,</span><br><span class="line">        &quot;RestartCount&quot;: 33,</span><br><span class="line">        &quot;Driver&quot;: &quot;overlay2&quot;,</span><br><span class="line">        &quot;Platform&quot;: &quot;linux&quot;,</span><br><span class="line">        &quot;MountLabel&quot;: &quot;&quot;,</span><br><span class="line">        &quot;ProcessLabel&quot;: &quot;&quot;,</span><br><span class="line">        &quot;AppArmorProfile&quot;: &quot;&quot;,</span><br><span class="line">        &quot;ExecIDs&quot;: null,</span><br><span class="line">        &quot;HostConfig&quot;: &#123;</span><br><span class="line">            &quot;Binds&quot;: [</span><br><span class="line">                &quot;/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu-18.04/8ac66888ddc5ab7e65547448cc3887d4bcb4a4335f01797f501e1bdbe2d4c064:/etc/mysql/conf.d/&quot;</span><br><span class="line">            ],</span><br><span class="line">            &quot;ContainerIDFile&quot;: &quot;&quot;,</span><br><span class="line">            &quot;LogConfig&quot;: &#123;</span><br><span class="line">                &quot;Type&quot;: &quot;json-file&quot;,</span><br><span class="line">                &quot;Config&quot;: &#123;&#125;</span><br><span class="line">            &#125;,</span><br><span class="line">            &quot;NetworkMode&quot;: &quot;default&quot;,</span><br><span class="line">            &quot;PortBindings&quot;: &#123;</span><br><span class="line">                &quot;3306/tcp&quot;: [</span><br><span class="line">                    &#123;</span><br><span class="line">                        &quot;HostIp&quot;: &quot;&quot;,</span><br><span class="line">                        &quot;HostPort&quot;: &quot;3306&quot;</span><br><span class="line">                    &#125;</span><br><span class="line">                ]</span><br><span class="line">            &#125;,</span><br><span class="line">            &quot;RestartPolicy&quot;: &#123;</span><br><span class="line">                &quot;Name&quot;: &quot;always&quot;,</span><br><span class="line">                &quot;MaximumRetryCount&quot;: 0</span><br><span class="line">            &#125;,</span><br><span class="line">            &quot;AutoRemove&quot;: false,</span><br><span class="line">            &quot;VolumeDriver&quot;: &quot;&quot;,</span><br><span class="line">            &quot;VolumesFrom&quot;: null,</span><br><span class="line">            &quot;CapAdd&quot;: null,</span><br><span class="line">            &quot;CapDrop&quot;: null,</span><br><span class="line">            &quot;Capabilities&quot;: null,</span><br><span class="line">            &quot;Dns&quot;: [],</span><br><span class="line">            &quot;DnsOptions&quot;: [],</span><br><span class="line">            &quot;DnsSearch&quot;: [],</span><br><span class="line">            &quot;ExtraHosts&quot;: null,</span><br><span class="line">            &quot;GroupAdd&quot;: null,</span><br><span class="line">            &quot;IpcMode&quot;: &quot;private&quot;,</span><br><span class="line">            &quot;Cgroup&quot;: &quot;&quot;,</span><br><span class="line">            &quot;Links&quot;: null,</span><br><span class="line">            &quot;OomScoreAdj&quot;: 0,</span><br><span class="line">            &quot;PidMode&quot;: &quot;&quot;,</span><br><span class="line">            &quot;Privileged&quot;: false,</span><br><span class="line">            &quot;PublishAllPorts&quot;: false,</span><br><span class="line">            &quot;ReadonlyRootfs&quot;: false,</span><br><span class="line">            &quot;SecurityOpt&quot;: null,</span><br><span class="line">            &quot;UTSMode&quot;: &quot;&quot;,</span><br><span class="line">            &quot;UsernsMode&quot;: &quot;&quot;,</span><br><span class="line">            &quot;ShmSize&quot;: 67108864,</span><br><span class="line">            &quot;Runtime&quot;: &quot;runc&quot;,</span><br><span class="line">            &quot;ConsoleSize&quot;: [</span><br><span class="line">                0,</span><br><span class="line">                0</span><br><span class="line">            ],</span><br><span class="line">            &quot;Isolation&quot;: &quot;&quot;,</span><br><span class="line">            &quot;CpuShares&quot;: 0,</span><br><span class="line">            &quot;Memory&quot;: 0,</span><br><span class="line">            &quot;NanoCpus&quot;: 0,</span><br><span class="line">            &quot;CgroupParent&quot;: &quot;&quot;,</span><br><span class="line">            &quot;BlkioWeight&quot;: 0,</span><br><span class="line">            &quot;BlkioWeightDevice&quot;: [],</span><br><span class="line">            &quot;BlkioDeviceReadBps&quot;: null,</span><br><span class="line">            &quot;BlkioDeviceWriteBps&quot;: null,</span><br><span class="line">            &quot;BlkioDeviceReadIOps&quot;: null,</span><br><span class="line">            &quot;BlkioDeviceWriteIOps&quot;: null,</span><br><span class="line">            &quot;CpuPeriod&quot;: 0,</span><br><span class="line">            &quot;CpuQuota&quot;: 0,</span><br><span class="line">            &quot;CpuRealtimePeriod&quot;: 0,</span><br><span class="line">            &quot;CpuRealtimeRuntime&quot;: 0,</span><br><span class="line">            &quot;CpusetCpus&quot;: &quot;&quot;,</span><br><span class="line">            &quot;CpusetMems&quot;: &quot;&quot;,</span><br><span class="line">            &quot;Devices&quot;: [],</span><br><span class="line">            &quot;DeviceCgroupRules&quot;: null,</span><br><span class="line">            &quot;DeviceRequests&quot;: null,</span><br><span class="line">            &quot;KernelMemory&quot;: 0,</span><br><span class="line">            &quot;KernelMemoryTCP&quot;: 0,</span><br><span class="line">            &quot;MemoryReservation&quot;: 0,</span><br><span class="line">            &quot;MemorySwap&quot;: 0,</span><br><span class="line">            &quot;MemorySwappiness&quot;: null,</span><br><span class="line">            &quot;OomKillDisable&quot;: false,</span><br><span class="line">            &quot;PidsLimit&quot;: null,</span><br><span class="line">            &quot;Ulimits&quot;: null,</span><br><span class="line">            &quot;CpuCount&quot;: 0,</span><br><span class="line">            &quot;CpuPercent&quot;: 0,</span><br><span class="line">            &quot;IOMaximumIOps&quot;: 0,</span><br><span class="line">            &quot;IOMaximumBandwidth&quot;: 0,</span><br><span class="line">            &quot;MaskedPaths&quot;: [</span><br><span class="line">                &quot;/proc/asound&quot;,</span><br><span class="line">                &quot;/proc/acpi&quot;,</span><br><span class="line">                &quot;/proc/kcore&quot;,</span><br><span class="line">                &quot;/proc/keys&quot;,</span><br><span class="line">                &quot;/proc/latency_stats&quot;,</span><br><span class="line">                &quot;/proc/timer_list&quot;,</span><br><span class="line">                &quot;/proc/timer_stats&quot;,</span><br><span class="line">                &quot;/proc/sched_debug&quot;,</span><br><span class="line">                &quot;/proc/scsi&quot;,</span><br><span class="line">                &quot;/sys/firmware&quot;</span><br><span class="line">            ],</span><br><span class="line">            &quot;ReadonlyPaths&quot;: [</span><br><span class="line">                &quot;/proc/bus&quot;,</span><br><span class="line">                &quot;/proc/fs&quot;,</span><br><span class="line">                &quot;/proc/irq&quot;,</span><br><span class="line">                &quot;/proc/sys&quot;,</span><br><span class="line">                &quot;/proc/sysrq-trigger&quot;</span><br><span class="line">            ]</span><br><span class="line">        &#125;,</span><br><span class="line">        &quot;GraphDriver&quot;: &#123;</span><br><span class="line">            &quot;Data&quot;: &#123;</span><br><span class="line">                &quot;LowerDir&quot;: &quot;/var/lib/docker/overlay2/b57a740dc9670d264c695f4a136b6e46e42240d758939ad65cf173061aa7d4c8-init/diff:/var/lib/docker/overlay2/87bce582fd488931cbca972b7f61519d38385f23ee80836a39ba7014f5635ac9/diff:/var/lib/docker/overlay2/6318730f8743d157082c93ee9c886195c1c3176eb11de567cbdfd6f54e774f16/diff:/var/lib/docker/overlay2/90c656399664ce30503470bd363bca2d1ccfd0da154308a77e601ed8f48d281f/diff:/var/lib/docker/overlay2/3172f465ad7c6b6e44a80c55409a0afb3bfd1cbc0a16deac0f801a86f05fc4f2/diff:/var/lib/docker/overlay2/1f5e3f31d2d978b51ed5130c89f57ac02ef30772c82c433e7f8673ddf3c938d0/diff:/var/lib/docker/overlay2/dadebaa0e1f9e01ac76d8232f002f070f9f2cb3c2a0067617eebd91d36dd07cb/diff:/var/lib/docker/overlay2/dce19b1ae50b568c46c9a16842ca8e48ee2ffd377d0cede2aa9e4b4aa08af803/diff:/var/lib/docker/overlay2/30f4e49dcefb302fe24e6629c67cd45d6078405d70eca990703cc7d62b69430d/diff:/var/lib/docker/overlay2/fd7265a988a0a0d03b3d7ee3b5da5f80db44284d2437ebfad75bd6e5b7444076/diff:/var/lib/docker/overlay2/e42a211354ae74210f3e316c3e2e85435f6c7da4edfa32448d259cfd4de0b17a/diff:/var/lib/docker/overlay2/d1bd8e90a8c29b5a6257e23ac38dcc423b589a3620b5e2e5aaf6605d0578f111/diff:/var/lib/docker/overlay2/82365cdb0dc4095e9d9b5d894ed81e38fbe8256600ecc0b4f6054b18c4b468fc/diff&quot;,</span><br><span class="line">                &quot;MergedDir&quot;: &quot;/var/lib/docker/overlay2/b57a740dc9670d264c695f4a136b6e46e42240d758939ad65cf173061aa7d4c8/merged&quot;,</span><br><span class="line">                &quot;UpperDir&quot;: &quot;/var/lib/docker/overlay2/b57a740dc9670d264c695f4a136b6e46e42240d758939ad65cf173061aa7d4c8/diff&quot;,</span><br><span class="line">                &quot;WorkDir&quot;: &quot;/var/lib/docker/overlay2/b57a740dc9670d264c695f4a136b6e46e42240d758939ad65cf173061aa7d4c8/work&quot;</span><br><span class="line">            &#125;,</span><br><span class="line">            &quot;Name&quot;: &quot;overlay2&quot;</span><br><span class="line">        &#125;,</span><br><span class="line">        &quot;Mounts&quot;: [</span><br><span class="line">            &#123;</span><br><span class="line">                &quot;Type&quot;: &quot;bind&quot;,</span><br><span class="line">                &quot;Source&quot;: &quot;/run/desktop/mnt/host/wsl/docker-desktop-bind-mounts/Ubuntu-18.04/8ac66888ddc5ab7e65547448cc3887d4bcb4a4335f01797f501e1bdbe2d4c064&quot;,</span><br><span class="line">                &quot;Destination&quot;: &quot;/etc/mysql/conf.d&quot;,</span><br><span class="line">                &quot;Mode&quot;: &quot;&quot;,</span><br><span class="line">                &quot;RW&quot;: true,</span><br><span class="line">                &quot;Propagation&quot;: &quot;rprivate&quot;</span><br><span class="line">            &#125;,</span><br><span class="line">            &#123;</span><br><span class="line">                &quot;Type&quot;: &quot;volume&quot;,</span><br><span class="line">                &quot;Name&quot;: &quot;ba28bfba87629a808db1d89e7c631c59afb46b7c1717dafeea4862e9cd01c74f&quot;,</span><br><span class="line">                &quot;Source&quot;: &quot;/var/lib/docker/volumes/ba28bfba87629a808db1d89e7c631c59afb46b7c1717dafeea4862e9cd01c74f/_data&quot;,</span><br><span class="line">                &quot;Destination&quot;: &quot;/var/lib/mysql&quot;,</span><br><span class="line">                &quot;Driver&quot;: &quot;local&quot;,</span><br><span class="line">                &quot;Mode&quot;: &quot;&quot;,</span><br><span class="line">                &quot;RW&quot;: true,</span><br><span class="line">                &quot;Propagation&quot;: &quot;&quot;</span><br><span class="line">            &#125;</span><br><span class="line">        ],</span><br><span class="line">        &quot;Config&quot;: &#123;</span><br><span class="line">            &quot;Hostname&quot;: &quot;9b8323b8b776&quot;,</span><br><span class="line">            &quot;Domainname&quot;: &quot;&quot;,</span><br><span class="line">            &quot;User&quot;: &quot;&quot;,</span><br><span class="line">            &quot;AttachStdin&quot;: false,</span><br><span class="line">            &quot;AttachStdout&quot;: false,</span><br><span class="line">            &quot;AttachStderr&quot;: false,</span><br><span class="line">            &quot;ExposedPorts&quot;: &#123;</span><br><span class="line">                &quot;3306/tcp&quot;: &#123;&#125;,</span><br><span class="line">                &quot;33060/tcp&quot;: &#123;&#125;</span><br><span class="line">            &#125;,</span><br><span class="line">            &quot;Tty&quot;: false,</span><br><span class="line">            &quot;OpenStdin&quot;: false,</span><br><span class="line">            &quot;StdinOnce&quot;: false,</span><br><span class="line">            &quot;Env&quot;: [</span><br><span class="line">                &quot;MYSQL_ROOT_PASSWORD=password&quot;,</span><br><span class="line">                &quot;PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin&quot;,</span><br><span class="line">                &quot;GOSU_VERSION=1.12&quot;,</span><br><span class="line">                &quot;MYSQL_MAJOR=8.0&quot;,</span><br><span class="line">                &quot;MYSQL_VERSION=8.0.21-1debian10&quot;</span><br><span class="line">            ],</span><br><span class="line">            &quot;Cmd&quot;: [</span><br><span class="line">                &quot;mysqld&quot;</span><br><span class="line">            ],</span><br><span class="line">            &quot;Image&quot;: &quot;mysql&quot;,</span><br><span class="line">            &quot;Volumes&quot;: &#123;</span><br><span class="line">                &quot;/var/lib/mysql&quot;: &#123;&#125;</span><br><span class="line">            &#125;,</span><br><span class="line">            &quot;WorkingDir&quot;: &quot;&quot;,</span><br><span class="line">            &quot;Entrypoint&quot;: [</span><br><span class="line">                &quot;docker-entrypoint.sh&quot;</span><br><span class="line">            ],</span><br><span class="line">            &quot;OnBuild&quot;: null,</span><br><span class="line">            &quot;Labels&quot;: &#123;</span><br><span class="line">                &quot;desktop.docker.io/wsl-distro&quot;: &quot;Ubuntu-18.04&quot;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;,</span><br><span class="line">        &quot;NetworkSettings&quot;: &#123;</span><br><span class="line">            &quot;Bridge&quot;: &quot;&quot;,</span><br><span class="line">            &quot;SandboxID&quot;: &quot;dd439fc5e2ee3fa27e421e0fe3b4ece1c120b98b6961ecdc6ee42b40d43c4a83&quot;,</span><br><span class="line">            &quot;HairpinMode&quot;: false,</span><br><span class="line">            &quot;LinkLocalIPv6Address&quot;: &quot;&quot;,</span><br><span class="line">            &quot;LinkLocalIPv6PrefixLen&quot;: 0,</span><br><span class="line">            &quot;Ports&quot;: &#123;</span><br><span class="line">                &quot;3306/tcp&quot;: [</span><br><span class="line">                    &#123;</span><br><span class="line">                        &quot;HostIp&quot;: &quot;0.0.0.0&quot;,</span><br><span class="line">                        &quot;HostPort&quot;: &quot;3306&quot;</span><br><span class="line">                    &#125;</span><br><span class="line">                ],</span><br><span class="line">                &quot;33060/tcp&quot;: null</span><br><span class="line">            &#125;,</span><br><span class="line">            &quot;SandboxKey&quot;: &quot;/var/run/docker/netns/dd439fc5e2ee&quot;,</span><br><span class="line">            &quot;SecondaryIPAddresses&quot;: null,</span><br><span class="line">            &quot;SecondaryIPv6Addresses&quot;: null,</span><br><span class="line">            &quot;EndpointID&quot;: &quot;3c0a3abec042c8f3d01cbfcce771521084e20943f73b821c28b807516057b52b&quot;,</span><br><span class="line">            &quot;Gateway&quot;: &quot;172.17.0.1&quot;,</span><br><span class="line">            &quot;GlobalIPv6Address&quot;: &quot;&quot;,</span><br><span class="line">            &quot;GlobalIPv6PrefixLen&quot;: 0,</span><br><span class="line">            &quot;IPAddress&quot;: &quot;172.17.0.3&quot;,</span><br><span class="line">            &quot;IPPrefixLen&quot;: 16,</span><br><span class="line">            &quot;IPv6Gateway&quot;: &quot;&quot;,</span><br><span class="line">            &quot;MacAddress&quot;: &quot;02:42:ac:11:00:03&quot;,</span><br><span class="line">            &quot;Networks&quot;: &#123;</span><br><span class="line">                &quot;bridge&quot;: &#123;</span><br><span class="line">                    &quot;IPAMConfig&quot;: null,</span><br><span class="line">                    &quot;Links&quot;: null,</span><br><span class="line">                    &quot;Aliases&quot;: null,</span><br><span class="line">                    &quot;NetworkID&quot;: &quot;2ba376b58dbcaaf7977f6259c8c531d75e2054834e7229b2fb3067ae4b498cf6&quot;,</span><br><span class="line">                    &quot;EndpointID&quot;: &quot;3c0a3abec042c8f3d01cbfcce771521084e20943f73b821c28b807516057b52b&quot;,</span><br><span class="line">                    &quot;Gateway&quot;: &quot;172.17.0.1&quot;,</span><br><span class="line">                    &quot;IPAddress&quot;: &quot;172.17.0.3&quot;,</span><br><span class="line">                    &quot;IPPrefixLen&quot;: 16,</span><br><span class="line">                    &quot;IPv6Gateway&quot;: &quot;&quot;,</span><br><span class="line">                    &quot;GlobalIPv6Address&quot;: &quot;&quot;,</span><br><span class="line">                    &quot;GlobalIPv6PrefixLen&quot;: 0,</span><br><span class="line">                    &quot;MacAddress&quot;: &quot;02:42:ac:11:00:03&quot;,</span><br><span class="line">                    &quot;DriverOpts&quot;: null</span><br><span class="line">                &#125;</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line">    &#125;</span><br><span class="line">]</span><br></pre>

<p>然后通过执行下面的命令在系统中查找修改的mysql的配置文件：</p>
<pre class="highlight"><span class="line">sudo find / <span class="literal">-name</span> my.cnf|grep b57a740dc9670d264c695f4a136b6e46e42240d758939ad65cf173061aa7d4c8</span><br></pre>

<p>其查找结果如下：</p>
<pre class="highlight"><span class="line">find: ‘/mnt/g/$RECYCLE.BIN/S-1-5-21-3058031379-647561273-1717587388-1001’: Permission denied</span><br><span class="line">find: ‘/mnt/g/$RECYCLE.BIN/S-1-5-21-3367617486-1606150748-2973973356-1001’: Permission denied</span><br><span class="line">find: ‘/mnt/g/System Volume Information’: Permission denied</span><br><span class="line">find: ‘/mnt/f/$RECYCLE.BIN/S-1-5-18’: Permission denied</span><br><span class="line">/mnt/wsl/docker-desktop-data/data/docker/overlay2/b57a740dc9670d264c695f4a136b6e46e42240d758939ad65cf173061aa7d4c8/diff/etc/mysql/my.cnf</span><br><span class="line">/mnt/wsl/docker-desktop-data/version-pack-data/community/docker/overlay2/b57a740dc9670d264c695f4a136b6e46e42240d758939ad65cf173061aa7d4c8/diff/etc/mysql/my.cnf</span><br><span class="line">find: ‘/mnt/f/$RECYCLE.BIN/S-1-5-21-1384193151-857152566-3001300872-1001’: Permission denied</span><br><span class="line">find: ‘/mnt/f/$RECYCLE.BIN/S-1-5-21-2754275188-1542917932-3877868850-1001’: Permission denied</span><br><span class="line">find: ‘/mnt/f/$RECYCLE.BIN/S-1-5-21-3058031379-647561273-1717587388-1001’: Permission denied</span><br><span class="line">find: ‘/mnt/f/$RECYCLE.BIN/S-1-5-21-3367617486-1606150748-2973973356-1001’: Permission denied</span><br><span class="line">find: ‘/mnt/f/$RECYCLE.BIN/S-1-5-21-3501511230-1569134962-2922809645-1001’: Permission denied</span><br><span class="line">find: ‘/mnt/f/app/laoma/admin/orcl/adump’: Permission denied</span><br><span class="line">find: ‘/mnt/f/app/laoma/admin/orcl/dpdump’: Permission denied</span><br><span class="line">find: ‘/mnt/f/app/laoma/admin/orcl/pfile’: Permission denied</span><br><span class="line">find: ‘/mnt/f/app/laoma/diag’: Permission denied</span><br><span class="line">find: ‘/mnt/f/app/laoma/flash_recovery_area’: Permission denied</span><br><span class="line">find: ‘/mnt/f/app/laoma/oradata/orcl’: Permission denied</span><br></pre>

<p>其中</p>
<pre class="highlight"><span class="line">/mnt/wsl/docker-desktop-data/data/docker/overlay2/b57a740dc9670d264c695f4a136b6e46e42240d758939ad65cf173061aa7d4c8/diff/etc/mysql/my.cnf</span><br></pre>

<p>就是docker 的MySQL容器的配置文件。故可以使用以下命令修改配置文件：</p>
<pre class="highlight"><span class="line">vi /mnt/wsl/docker<span class="literal">-desktop</span><span class="literal">-data</span>/<span class="keyword">data</span>/docker/overlay2/b57a740dc9670d264c695f4a136b6e46e42240d758939ad65cf173061aa7d4c8/<span class="built_in">diff</span>/etc/mysql/my.cnf</span><br></pre>


  </div>
  <div>
    
      <div 
        class="post-note note-warning copyright" 
        style="margin-top: 42px">
        <p>
          <span style="font-weight: bold;">作者：</span><a 
            target="_blank" 
            rel="nofollow noopener noreferrer" 
            href="/fungloengblog/about">
            IAMFUNGLOENG
          </a>
        </p>
        <p>
          <span style="font-weight: bold;">文章链接：</span><a 
            target="_blank" 
            rel="nofollow noopener noreferrer" 
            href="https://laoma.gitee.io/fungloengblog/2020/08/11/Mysql-Host-is-blocked-because-of-many-connection-errors/">
            https://laoma.gitee.io/fungloengblog/2020/08/11/Mysql-Host-is-blocked-because-of-many-connection-errors/
          </a>
        </p>
        <p><span style="font-weight: bold;">版权声明：</span>本博客所有文章除特别声明外，均采用<a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/deed.zh">CC BY-NC-SA 4.0 协议</a>。转载请注明出处！</p>
      </div>
    
  </div>
</article>
<div class="nav">
  
    <div class="nav-item-prev">
      <a 
        href="/fungloengblog/2021/12/20/hello-world/" 
        class="nav-link">
        <i class="iconfont icon-left nav-prev-icon"></i>
        <div>
          <div class="nav-label">上一篇</div>
          
            <div class="nav-title">Hello World </div>
          
        </div>
      </a>
    </div>
  
  
    <div class="nav-item-next">
      <a 
        href="/fungloengblog/2020/08/08/canal%E5%90%8C%E6%AD%A5MySQL%E6%95%B0%E6%8D%AE%E9%85%8D%E7%BD%AE/" 
        class="nav-link">
        <div>
          <div class="nav-label">下一篇</div>
          
            <div class="nav-title">canal同步MySQL数据配置 </div>
          
        </div>
        <i class="iconfont icon-right nav-next-icon"></i>
      </a>
    </div>
  
</div>

<div 
  class="card card-content toc-card" 
  id="mobiletoc">
  <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%97%AE%E9%A2%98"><span class="toc-text">问题</span></a></li></ol>
</div></main>
            <aside class="left-column">
              
              <div class="card card-author">
                
  <img 
    src="https://demo.theme-kaze.top/img/Kaze.png" 
    class="author-img"
    width="88"
    height="88"
    alt="author avatar">

<p class="author-name">IAMFUNGLOENG</p>
<p class="author-description">designed by fungloeng</p>
<div class="author-message">
  <a 
    class="author-posts-count" 
    href="/fungloengblog/archives">
    <span>27</span>
    <span>文章</span>
  </a>
  <a 
    class="author-categories-count" 
    href="/fungloengblog/categories">
    <span>8</span>
    <span>分类</span>
  </a>
  <a 
    class="author-tags-count" 
    href="/fungloengblog/tags">
    <span>20</span>
    <span>标签</span>
  </a>
</div>

              </div>
               <div class="sticky-tablet">
  
  
    <article class="display-when-two-columns spacer">
      <div class="card card-content toc-card">
        <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%97%AE%E9%A2%98"><span class="toc-text">问题</span></a></li></ol>
      </div>
    </article>
  
  
  <article class="card card-content categories-widget">
    <div class="categories-card">
  <div class="categories-header">
    <i 
      class="iconfont icon-fenlei" 
      style="padding-right: 2px;">
    </i>分类
  </div>
  <div class="categories-list">
    
      <a href="/fungloengblog/categories/hexo/">
        <div class="categories-list-item">
          hexo
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
      <a href="/fungloengblog/categories/docker/">
        <div class="categories-list-item">
          docker
          <span class="categories-list-item-badge">2</span>
        </div>
      </a>
    
      <a href="/fungloengblog/categories/docker/fastdfs/">
        <div class="categories-list-item">
          docker/fastdfs
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
      <a href="/fungloengblog/categories/docker/mysql/">
        <div class="categories-list-item">
          docker/mysql
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
      <a href="/fungloengblog/categories/idea/">
        <div class="categories-list-item">
          idea
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
      <a href="/fungloengblog/categories/idea/github/">
        <div class="categories-list-item">
          idea/github
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
      <a href="/fungloengblog/categories/win10/">
        <div class="categories-list-item">
          win10
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
      <a href="/fungloengblog/categories/win10/hyper-v/">
        <div class="categories-list-item">
          win10/hyper-v
          <span class="categories-list-item-badge">1</span>
        </div>
      </a>
    
  </div>
</div>
  </article>
  
  <article class="card card-content tags-widget">
    <div class="tags-card">
  <div class="tags-header">
    <i 
      class="iconfont icon-biaoqian" 
      style="padding-right: 2px;">
    </i>热门标签
  </div>
  <div class="tags-list">
    
      <a 
        href="/fungloengblog/tags/ubuntu/" 
        title="ubuntu">
        <div class="tags-list-item">ubuntu</div>
      </a>
    
      <a 
        href="/fungloengblog/tags/docker/" 
        title="docker">
        <div class="tags-list-item">docker</div>
      </a>
    
      <a 
        href="/fungloengblog/tags/openresty/" 
        title="openresty">
        <div class="tags-list-item">openresty</div>
      </a>
    
      <a 
        href="/fungloengblog/tags/wsl2/" 
        title="wsl2">
        <div class="tags-list-item">wsl2</div>
      </a>
    
      <a 
        href="/fungloengblog/tags/win10/" 
        title="win10">
        <div class="tags-list-item">win10</div>
      </a>
    
      <a 
        href="/fungloengblog/tags/lua/" 
        title="lua">
        <div class="tags-list-item">lua</div>
      </a>
    
      <a 
        href="/fungloengblog/tags/java/" 
        title="java">
        <div class="tags-list-item">java</div>
      </a>
    
      <a 
        href="/fungloengblog/tags/canal/" 
        title="canal">
        <div class="tags-list-item">canal</div>
      </a>
    
      <a 
        href="/fungloengblog/tags/MySQL/" 
        title="MySQL">
        <div class="tags-list-item">MySQL</div>
      </a>
    
      <a 
        href="/fungloengblog/tags/wsl/" 
        title="wsl">
        <div class="tags-list-item">wsl</div>
      </a>
    
      <a 
        href="/fungloengblog/tags/port/" 
        title="port">
        <div class="tags-list-item">port</div>
      </a>
    
      <a 
        href="/fungloengblog/tags/hyper-v/" 
        title="hyper-v">
        <div class="tags-list-item">hyper-v</div>
      </a>
    
      <a 
        href="/fungloengblog/tags/wsl1/" 
        title="wsl1">
        <div class="tags-list-item">wsl1</div>
      </a>
    
      <a 
        href="/fungloengblog/tags/windows10/" 
        title="windows10">
        <div class="tags-list-item">windows10</div>
      </a>
    
      <a 
        href="/fungloengblog/tags/gui/" 
        title="gui">
        <div class="tags-list-item">gui</div>
      </a>
    
      <a 
        href="/fungloengblog/tags/nginx/" 
        title="nginx">
        <div class="tags-list-item">nginx</div>
      </a>
    
  </div>
</div>
  </article>
  
  
</div>
            </aside>
            <aside class="right-column">
              <div class="sticky-widescreen">
  
  
    <article class="card card-content toc-card">
      <div class="toc-header">
  <i 
    class="iconfont icon-menu" 
    style="padding-right: 2px;">
  </i>目录
</div>
<ol class="toc"><li class="toc-item toc-level-3"><a class="toc-link" href="#%E9%97%AE%E9%A2%98"><span class="toc-text">问题</span></a></li></ol>
    </article>
  
  
  <article class="card card-content">
    <div class="recent-posts-card">
  <div class="recent-posts-header">
    <i 
      class="iconfont icon-wenzhang_huaban" 
      style="padding-right: 2px;">
    </i>最近文章
  </div>
  <div class="recent-posts-list">
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2021-12-21</div>
        <a href="/fungloengblog/2021/12/21/centos7%E6%90%AD%E5%BB%BA%E5%8D%9A%E5%AE%A2/"><div class="recent-posts-item-content">centos7搭建博客</div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2021-12-21</div>
        <a href="/fungloengblog/2021/12/21/centos7%E5%8F%96%E6%B6%88%E8%87%AA%E5%8A%A8%E4%BC%91%E7%9C%A0/"><div class="recent-posts-item-content"></div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2021-12-21</div>
        <a href="/fungloengblog/2021/12/21/centos7%E5%AE%89%E8%A3%85docker/"><div class="recent-posts-item-content"></div></a>
      </div>
    
      <div class="recent-posts-item">
        <div class="recent-posts-item-title">2021-12-21</div>
        <a href="/fungloengblog/2021/12/21/docker%E5%AE%89%E8%A3%85jenkins/"><div class="recent-posts-item-content"></div></a>
      </div>
    
  </div>
</div>
  </article>
  
  
</div>
            </aside>
          </div>
        </div>
      </div>
    </div>
     
    <footer class="footer">
  <div class="footer-container">
    <div>
      <div class="footer-dsc">
        <span>
          Copyright ©
          
            2020 -
          
          2021
        </span>
        &nbsp;
        <a 
          href="/fungloengblog/" 
          class="footer-link">
          FUNGLOENG
        </a>
      </div>
    </div>

    
      <div class="footer-dsc">
        
          Powered by
          <a 
            href="https://hexo.io/" 
            class="footer-link" 
            target="_blank" 
            rel="nofollow noopener noreferrer">
            &nbsp;Hexo
          </a>
        
        
          <span>&nbsp;|&nbsp;</span>
        
        
          Theme -
          <a 
            href="https://github.com/theme-kaze" 
            class="footer-link" 
            target="_blank"
            rel="nofollow noopener noreferrer">
            &nbsp;Kaze
          </a>
        
      </div>
    
    
    
    
      <div class="footer-dsc">
        
          本站总访问量<span id="busuanzi_value_site_pv"></span>次
        
        
          <span>&nbsp;|&nbsp;</span>
        
        
          本站总访客数<span id="busuanzi_value_site_uv"></span>次
        
      </div>
      
    
</footer> 
    
  <a 
    role="button" 
    id="scrollbutton" 
    class="basebutton" 
    aria-label="回到顶部">
    <i class="iconfont icon-arrowleft button-icon"></i>
  </a>

<a 
  role="button" 
  id="menubutton"
  aria-label="menu button"
  class="basebutton">
  <i class="iconfont icon-menu button-icon"></i>
</a>
<a 
  role="button" 
  id="popbutton" 
  class="basebutton" 
  aria-label="控制中心">
  <i class="iconfont icon-expand button-icon"></i>
</a>
<a 
  role="button" 
  id="darkbutton" 
  class="basebutton darkwidget" 
  aria-label="夜色模式">
  <i class="iconfont icon-weather button-icon"></i>
</a>
<a 
  role="button" 
  id="searchbutton" 
  class="basebutton searchwidget" 
  aria-label="搜索">
  <i class="iconfont icon-search button-icon"></i>
</a> 
     
     
     
      <script>
  var addImgLayout = function () {
    var img = document.querySelectorAll('.post-content img')
    var i
    for (i = 0; i < img.length; i++) {
      var wrapper = document.createElement('a')
      wrapper.setAttribute('href', img[i].getAttribute('data-src'))
      wrapper.setAttribute('aria-label', 'illustration')
      wrapper.style.cssText =
        'width: 100%; display: flex; justify-content: center;'
      if (img[i].alt) wrapper.dataset.caption = img[i].alt
      wrapper.dataset.nolink = true
      img[i].before(wrapper)
      wrapper.append(img[i])
      var divWrap = document.createElement('div')
      divWrap.classList.add('gallery')
      wrapper.before(divWrap)
      divWrap.append(wrapper)
    }
    baguetteBox.run('.gallery')
  }
</script>
<script>
  loadScript(
    "/fungloengblog/js/lib/lightbox/baguetteBox.min.js",
    addImgLayout
  )
</script>
 
     
     
    <script src="/fungloengblog/js/main.js"></script> 
    
      <script> 
        loadScript('/fungloengblog/js/lib/busuanzi.min.js') 
      </script>
     
    
      <script>
        var addLazyload = function () {
          var observer = lozad('.lozad', {
            load: function (el) {
              el.srcset = el.getAttribute('data-src')
            },
            loaded: function (el) {
              el.classList.add('loaded')
            },
          })
          observer.observe()
        }
      </script>
      <script>
        loadScript('/fungloengblog/js/lib/lozad.min.js', addLazyload)
      </script>
     
    
    
  </body>
</html>
